import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 路线-自动信息 */
export interface Links {
          id: number; // ID
          localPortId: number; // 本地端口ID
          localDeviceId: number; // 本地设备ID
          remotePortId: number; // 远端端口ID
          active?: number; // 线路是否激活1是0否
          protocol: string; // 发现链路所用协议
          remoteHostname: string; // 远端设备主机
          remoteDeviceId: number; // 远端设备ID
          remotePort: string; // 远端物理端口
          remotePlatform: string; // 远端设备平台信息
          remoteVersion: string; // 远端设备系统版本
          manual: string; // 是否手动默认0自动1手动
          isCritical: number; // 是否是关联链路0否1是
          sysname: string; // 名称
          boardId: number; // 画板id
          warningLine: number; // 警戒线
  }

// 路线-自动 API
export const LinksApi = {
  // 查询路线-自动分页
  getLinksPage: async (params: any) => {
    return await request.get({ url: `/business/links/page`, params })
  },

  // 查询路线-自动详情
  getLinks: async (id: number) => {
    return await request.get({ url: `/business/links/get?id=` + id })
  },

  // 新增路线-自动
  createLinks: async (data: Links) => {
    return await request.post({ url: `/business/links/create`, data })
  },

  // 修改路线-自动
  updateLinks: async (data: Links) => {
    return await request.put({ url: `/business/links/update`, data })
  },

  // 删除路线-自动
  deleteLinks: async (id: number) => {
    return await request.delete({ url: `/business/links/delete?id=` + id })
  },

  /** 批量删除路线-自动 */
  deleteLinksList: async (ids: number[]) => {
    return await request.delete({ url: `/business/links/delete-list?ids=${ids.join(',')}` })
  },

  // 导出路线-自动 Excel
  exportLinks: async (params) => {
    return await request.download({ url: `/business/links/export-excel`, params })
  },
}